<?php

namespace app\common\model;

use Shopwwi\LaravelCache\Cache;
use think\Model;

/**
 * em_admin_menu 后台菜单表
 * @property integer $id (主键)
 * @property integer $parent_id 父菜单id
 * @property integer $type 1.目录，2.菜单，3.权限按钮
 * @property string $path 路由地址
 * @property integer $status 状态;1:显示,0:不显示
 * @property integer $list_order 排序
 * @property string $name 菜单名称
 * @property string $alias 别名
 * @property string $icon 菜单图标
 * @property string $remark 备注
 * @property string $key
 */
class AdminMenu extends Model
{
    
    /**
     * The connection name for the model.
     *
     * @var string|null
     */
    protected $connection = 'mysql';
    
    /**
     * The table associated with the model.
     *
     * @var string
     */
    protected $table = 'em_admin_menu';
    
    /**
     * The primary key associated with the table.
     *
     * @var string
     */
    protected $pk = 'id';
    
    
    public static function getMenus()
    {
        if (!Cache::has('em_admin_menu')) {
            $menus = self::select()->toArray();
            Cache::put('em_admin_menu', $menus);
        }
        return Cache::get('em_admin_menu');
    }
    
}
